$(document).ready(function () {
    if (!document.getElementsByTagName){
        return false;
    }
    var torrents = $('#torrents');
    var torrents_dropdown = $('#torrents_dropdown');
    var profile = $('#profile');
    var profile_dropdown = $('#profile_dropdown');
    //Adds dropdown menus..
    addDropdown(torrents, torrents_dropdown);
    addDropdown(profile, profile_dropdown);

    return true;
});

function addDropdown(menu, dropdown) {
    $(menu).hover(function () {
        var x = $(this).offset().left;
        var y = $(this).offset().top + $(this).outerHeight();
        $(dropdown).css({
            "top":y ,
            "left":x
        });
        $(dropdown).css({
            "display":"block"
        });
        $(dropdown).animate({
            opacity:100
        },500, "easein",function () {});
    },function () {
        $(dropdown).css({
            "display":"none"
        });
    })
    $(dropdown).hover(function (){
        $(this).css({
            "display":"block"
        });
    },function (){
        $(this).css({
            "display":"none"
        });
    })
}